Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract option supports simple array #502

Merged
merged 6 commits into from
Dec 18, 2024
Merged

Conversation

Martin-Zeithaml
Copy link
Contributor

@Martin-Zeithaml Martin-Zeithaml commented Nov 29, 2024

Proposed changes

configmgr extract feature is able to process only primitive datatypes. This PR enables to extract simple arrays (arrays NOT containing arrays or objects).

  • Supported: [ 0, 1, 2, 'Hello' ]
  • Not supported: [ [ 0, 1 ], 2, [ 'apple', 'banana' ] ]

Also it is returning non-zero RC for errors.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

PR Checklist

Please delete options that are not relevant.

  • If the changes in this PR are meant for the next release / mainline, this PR targets the "staging" branch.
  • My code follows the style guidelines of this project (see: [Contributing guideline]
  • Relevant update to CHANGELOG.md
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works, or describe a test method below

Testing

test:
  number1: 0
  number2: "${{ 9 * 13 }}"
  number3: 123456789
  boolean1: false
  boolean2: "${{ 1 === 1 }}"
  null1: ~
  null2: null
  null3:
  string1: 'Hello, World!'
  string2: "${{ 'a'.repeat(16) }}"
  array1:
    - 'apple'
    - 'banana'
    - 'kiwi'
  array2: [ 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5 ]
  array3:
    - 'string'
    - 0
    - true
    - "${{ 1 + 1 }}"
    - "${{ [ 1, 2, 3 ].toString() }}"
    - ~
  array4: []
  array5: [ ~, ~, ~ ]
  error_expected1:
    - 'First item'
    - [ 0, 1 ]
    - [ 0, 1, 2 ]
  error_expected2:
    NESTED:
      OBJECTS:
        SUPPORTED: false
rc=0: Item number1 -> 0
rc=0: Item number2 -> 117
rc=0: Item number3 -> 123456789
rc=0: Item boolean1 -> false
rc=0: Item boolean2 -> true
rc=0: Item null1 -> null
rc=0: Item null2 -> null
rc=0: Item null3 -> null
rc=0: Item string1 -> Hello, World!
rc=0: Item string2 -> aaaaaaaaaaaaaaaa
rc=0: Item array1 -> apple
banana
kiwi
rc=0: Item array2 -> 3
1
4
1
5
9
2
6
5
3
5
rc=0: Item array3 -> string
0
true
2
1,2,3
null
rc=0: Item array4 ->
rc=0: Item array5 -> null
null
null
rc=16: Item error_expected1 -> First item
error: cannot access objects or arrays in arrays
rc=16: Item error_expected2 -> error: cannot access whole objects

Martin-Zeithaml and others added 4 commits November 29, 2024 12:59
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
@JoeNemo
Copy link
Contributor

JoeNemo commented Dec 4, 2024

@Martin-Zeithaml Do you consider this done??

Copy link
Contributor

@JoeNemo JoeNemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@JoeNemo JoeNemo merged commit 996d469 into v3.x/staging Dec 18, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants